<!DOCTYPE html>
<html>
<head>
<title>商品类别管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../../include/resources.html">
<script type="text/javascript">
    var dataGrid;
    var winWidth =  420;
    var winHeight = 380;
    var addTitle = "添加商品类别";
	var addUrl =  "/modules/user/score/goodsCategory/append.html";
	var editTitle = "编辑商品类别";
    var editUrl =  "/modules/user/score/goodsCategory/modify.html";
    var editWinParmeters = "'{0}','"+editTitle+"',400,350,'"+editUrl+"'";
    var disableUrl = "/modules/user/score/goodsCategory/disable.html";
	var enableUrl = "/modules/user/score/goodsCategory/enable.html";
	var txt1 = "禁用";
	var txt2 = "启用";
	var val1 = true;
	var val2 = false;
    
    $(function() {
        dataGrid = $('#dataGrid').datagrid({
            url : 'list.html',
            fit : true,
            fitColumns : true,
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : pageSize,
            pageNums :1,
            pageList : pageList,
            sortName : 'id',
            sortOrder : 'asc',
            checkOnSelect : false,
            selectOnCheck : false,
            nowrap : false,
			singleSelect:true,
            columns : [ [
			  { field: 'id', title: '编号', width: 50, sortable:false },              
              { field: 'name', title: '类别名称', width: 150, sortable:false },
              { field: 'sort', title: '排序', width: 50, sortable:false }, 
              { field: 'remark', title: '备注', width: 400, sortable:false },
              { field: 'addTime', title: '添加时间', width: 150, sortable:false, 
            	  	formatter: function(value,row,index){
            	  		return getLocalTime(value,4);
  				  	}  
              },
              { field: 'status', title: '状态', width: 60, sortable:false, 
            	  	formatter: function(value,row,index){
            	  		if(value==0){
            	  			return "未启用";
            	  		} else if(value==1){
            	  			return "启用";
            	  		}
  			  	}
  			  },
              { field : 'action',
  				title : '操作',
                width :75,
                fixed:true,
                formatter : function(value, row, index) {
                    var str = '';
                    str += '<dl>';
                    str += '<dt><a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="编辑商品分类">编辑</a><i class="iconfont">&#xe639;</i></dt>';
                    str += '<dd>';
                    if(row.status==1){
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',disableUrl,txt1,val1);">禁用</a>';
					} else if(row.status==0){
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',enableUrl,txt2,val2);">启用</a>';
					}
                    str += '</dd>';
                    str +=  '</dl>'
                    return str;
                }
            } ] ],
            toolbar : '#toolbar',
            onLoadSuccess : function() {
                $('#searchForm table').show();
                parent.$.messager.progress('close');
            },
            onRowContextMenu : function(e, rowIndex, rowData) {
                e.preventDefault();
                $(this).datagrid('unselectAll').datagrid('uncheckAll');
                $(this).datagrid('selectRow', rowIndex);
                $('#menu').menu('show', {
                    left : e.pageX,
                    top : e.pageY
                });
            }
        });
    });
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
        <div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入商品分类名进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a><a href="javascript:;" class="advBtn" title="条件查询">条件查询 <i class="iconfont">&#xe638;</i></a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
            <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>	
            </div>
            <form id="showAdw" autocomplete="off">
		        <ul class="showAdw" style="display:none;">
		        	<a href="javascript:void(0);"><i class="iconfont closeWin">&#xe628;</i></a>
		        	<li><span>类别名称</span><input type="text" name="name"/></li>
		        	<li><span>状态</span><select name="status" class="type">
							<option value="99" selected="selected">全部</option>
							<option value="0">未启用</option>
							<option value="1">启用</option>
						</select></li>
		       		<li><span>时间</span><input type="text" name="startTime" id="startTime" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}',readOnly:true})" class="searchTime"/>&nbsp;-&nbsp;<input type="text" name="endTime" id="endTime" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',readOnly:true})" class="searchTime"/></li>
		       		<li><span>&nbsp;</span><a href="javascript:void(0);" class="searchBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#showAdw');">确定</a><a href="javascript:void(0);" class="searchBtn" onclick="$.fn.dataGridOptions.cleanFun('#searchForm');">重置</a></li>
		        </ul>
	        </form>
        </div>
        <div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
            <table id="dataGrid"></table>
        </div>
    </div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>